package com.taotao.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.EasyUIDataGridResult;
import com.taotao.common.pojo.TaotaoResult;
import com.taotao.common.util.JsonUtils;
import com.taotao.content.service.ContentService;
import com.taotao.pojo.TbContent;

/**
 * 内容处理表现层
 * @title ContentController
 * <p>description</p>
 * <p>company: www.itheima.com</p>
 * @author 天火
 * @version 1.0
 */
@Controller
public class ContentController {
	
	@Autowired
	private ContentService contentService;
	
	//$.post("/content/save",$("#contentAddForm").serialize()
	@RequestMapping(value="/content/save",method=RequestMethod.POST)
	@ResponseBody
	public TaotaoResult saveContent(TbContent tbContent) {
		
		//1.引入服务
		//2.注入服务
		//3.调用服务
		
		return contentService.saveContent(tbContent);
	}
	
	@RequestMapping(value="/content/query/list",method=RequestMethod.GET)
	@ResponseBody
	public EasyUIDataGridResult getContentByCategoryId(Long categoryId,Integer page, Integer rows) {
		//1.引入服务
		//2.注入服务
		//3.调用服务
		return contentService.getContentByCategoryIdList(categoryId, page, rows);
	}

}
